package edu.pku.sei.transformation.atl.adapter;

import edu.pku.sei.transformation.editor.model.RuleInvoke;
import edu.pku.sei.transformation.editor.model.TypedModel;
import edu.pku.sei.transformation.editor.views.problem.ProblemView;

public class ATLPostRuleInvokeExpression extends ATLInvokeExpression {
	public ATLPostRuleInvokeExpression(RuleInvoke invoke, TypedModel target)
			throws Exception {
		super(invoke, target);
		if (ruleInvoke.getParameters().size() != 2) {
			ProblemView.addError(ruleInvoke.getModel(),
					ProblemView.CODEGEN_ATL, "invoke error",
					"only support invoke with 2 parameters", invoke.getCaller()
							.getName()
							+ "->" + invoke.getCallee().getName());
			throw new Exception("only support invoke with 2 parameters");
		}

	}

	@Override
	public String getContent() {
		return output + " <- thisModule." + ruleInvoke.getCallee().getName()
				+ "(" + input + ")";
	}

}
